package abstracttransactions

import (
	"salary/database"
	"salary/model"
	"salary/modelimplementation"
)
/*
 * 增加雇员
 */

type AddEmployeeTransaction struct {
	empid   	int
	name    	string
	address 	string
	Classification
	Schedule
}

func (aet *AddEmployeeTransaction) Execute() {
	pc := aet.GetClassification()
	ps := aet.GetSchedule()
	pm := &modelimplementation.HoldMethod{}
	e := model.NewEmployee(aet.empid, aet.name, aet.address)
	e.SetSchedule(ps)
	e.SetClassification(pc)
	e.SetMethod(pm)
	database.Database.AddEmployee(e.GetEmpid(), *e)
}

